<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      template="WEB-INF/facelets/template.xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:param name="title" value="Result" />
    <ui:define name="content">
        <h1>Results</h1>
        <div>
            <c:forEach var="entry" items="#{testBean.answers}">
                
                <c:if test="#{entry.value.right == true}">
                    <h:outputLabel value="#{entry.key.title} " style="font-weight: bold" /><br />
                    <h:outputLabel value="#{entry.value.content}" style="color: green" /><br />
                </c:if>
                <c:if test="#{entry.value.right == false}">
                    <h:outputLabel value="#{entry.key.title} " style="font-weight: bold" /><br />
                    <h:outputLabel value="#{entry.value.content}" style="color: red" /><br />
                </c:if>
                <br />
            </c:forEach>
            <b>Score:</b><br />
	    #{testBean.correct}/#{testBean.incorrect + testBean.correct},
	    #{testBean.percentage}%
        </div><br />
        <h:form>
            <h:commandButton styleClass="button" value="Back to Categories" action="#{testBean.goBack}" />
        </h:form>
    </ui:define>

</ui:composition>
